<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2024/8/7
  Time: 9:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>pagecontext作用域</title>
</head>
<body>
    <%
        List<String> books = new ArrayList<String>();
        books.add("《三国演义》");
        books.add("《西游记》");
        books.add("《水浒传》");
        books.add("《红楼梦》");
        // 将上面的集合放到pageContext作用域中
        pageContext.setAttribute("books",books);
        request.getRequestDispatcher("/list.jsp").forward(request,response);

        // pageContext: 作用域代表数据只在当前页面有效，不管是转发还是重定向在另一个页面都取不到数据！
    %>
</body>
</html>
